package com.ruoyi.driver.enums;

/**
 * @author lipengze
 * @version 1.0
 * @description: TODO
 * @date 2024/10/24 8:44
 */
public enum FaceActionEnum {
    BLINK("BLINK", "眨眼"),
    MOUTH("MOUTH", "张嘴"),
    NOD("NOD", "点头"),
    YAW("YAW", "摇头");

    private final String actionName;
    private final String actionDescription;

    FaceActionEnum(String name, String description) {
        this.actionName = name;
        this.actionDescription = description;
    }

    public String getActionName() {
        return actionName;
    }

    public String getActionDescription() {
        return actionDescription;
    }

    // 示例方法：根据动作名称返回对应的枚举对象
    public static FaceActionEnum fromActionName(String name) {
        for (FaceActionEnum action : FaceActionEnum.values()) {
            if (action.getActionName().equals(name)) {
                return action;
            }
        }
        throw new IllegalArgumentException("未知的动作名称: " + name);
    }

    // 示例方法：根据动作描述返回对应的枚举对象
    public static FaceActionEnum fromActionDescription(String description) {
        for (FaceActionEnum action : FaceActionEnum.values()) {
            if (action.getActionDescription().equals(description)) {
                return action;
            }
        }
        throw new IllegalArgumentException("未知的动作描述: " + description);
    }
}
